﻿@using Dal.Models
@using Webdiyer.WebControls.Mvc
@model Web.Controllers.QueryModel
@{
    Layout = null;
    ViewBag.Nav = 3;
    ViewBag.Menu = 0;
    int ti = 1;
}
@helper Split(string content, int index)
    {
        if (!string.IsNullOrWhiteSpace(content))
        {
            string[] arr = content.Split(',');
            if (arr.Length >= index + 1)
            {
    <text> @(arr[index])</text>
            }
        }
    
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    @Html.Partial("meta")
</head>
<body id="b_main">
    @Html.Partial("header")
    <!--/end #header-->
    <div id="wrapper">
        <!--holds pretty much everything-->
        <div id="content">
            @Html.Partial("nav")
            @using (Html.BeginForm("manage", "doc", FormMethod.Get, new { @class = "broom_form", id = "form0", style = "margin-left: 30px;" }))
            {
                <input type="hidden" name="type" id="type"/>
                <table border="0" cellspacing="0" summary="table" class="broom_table">
                    <tbody>
                        <tr class="odd">
                            <td style="border-right: 0px; width: 400px;">
                                省份
                                @Html.TextBoxFor(i => i.Province, new { @class = "inputbox" })
                            </td>
                            <td>
                                城市
                                @Html.TextBoxFor(i => i.City, new { @class = "inputbox" })
                            </td>
                        </tr>
                        <tr class="even">
                            <td style="border-right: 0px; width: 400px;">
                                医院
                                @Html.TextBoxFor(i => i.Hospital, new { @class = "inputbox" })
                            </td>
                            <td>
                                科室
                                @Html.TextBoxFor(i => i.Department, new { @class = "inputbox" })
                            </td>
                        </tr>
                        <tr class="odd">
                            <td style="border-right: 0px; width: 400px;">
                                产品
                                @Html.TextBoxFor(i => i.Product, new { @class = "inputbox" })
                            </td>
                            <td>
                                <span style="color: red">*搜索多个省份/城市/医院/科室/产品,将关键字用逗号或空格分开,例如:辽宁,山东</span>
                            </td>
                        </tr>
                    </tbody>
                </table>
                <table border="0" cellspacing="0" summary="table" class="broom_table">
                    <tbody>
                        <tr class="even">
                            <td>
                                <div>
                                    会议时间
                                </div>
                            </td>
                            <td style="border-right: 0px;">
                                开始时间
                            </td>
                            <td style="border-right: 0px; width: 250px;">
                                <div class="rili">
                                    @Html.TextBox("InputStart0", Model != null && Model.InputStart0.HasValue ? Model.InputStart0.Value.ToString("yyyy-MM-dd") : null, new { @class = "inputbox date-pick", @readonly = "readonly" })
                                </div>
                            </td>
                            <td style="border-right: 0px;">
                            </td>
                            <td>
                                <div class="rili">
                                    @Html.TextBox("InputStart1", Model != null && Model.InputStart1.HasValue ? Model.InputStart1.Value.ToString("yyyy-MM-dd") : null, new { @class = "inputbox date-pick", @readonly = "readonly" })
                                </div>
                            </td>
                        </tr>
                    </tbody>
                </table>
                
                <table border="0" cellspacing="0" summary="table" class="broom_table">
                    <tbody>
                        <tr class="even">
                            <td>
                                <input onclick="$('#type').val('科室会'); $('#form0').submit(); return false;" type="submit" name="searchks" value="搜索科室会"/>&nbsp;&nbsp;
                                <input onclick="$('#type').val('城市会'); $('#form0').submit(); return false;" type="submit" name="searchcs" value="搜索城市会"/>&nbsp;&nbsp;
                                <a href="/doc/Export@(Request.Url.Query)">导出Excel</a>&nbsp;&nbsp;
                                <a href="javascript:void(0)" onclick="window.print()">打印当前页面</a>
                            </td>
                        </tr>
                    </tbody>
                </table>
            }
            @using (Html.BeginForm("manage", "doc", FormMethod.Post, new { @class = "broom_form", id = "form1", style = "margin-left: 30px;" }))
            {
                if (ViewBag.Record != null && ViewBag.Record.Count > 0)
                {
                <h4 class="titlebold">
                    <br />
                    搜索结果列表:共计@(ViewBag.RecordCount)项
                </h4>
                <table cellspacing="0" summary="table" class="broom_table">
                    <tbody>
                        <tr class="odd titlebold">
                            <td>
                                会议编号
                            </td>
                            <td>
                                开通电话
                            </td>
                            <td>
                                产品
                            </td>
                            <td>
                                省
                            </td>
                            <td>
                                市
                            </td>
                            <td>
                                医院
                            </td>
                            <td>
                                科室
                            </td>
                            <td>
                                开始时间
                            </td>
                            <td>
                                结束时间
                            </td>
                            <td>
                                参加人数
                            </td>
                            <td>
                                查看详情
                            </td>
                        </tr>
                        @foreach (var DocForShow in (List<MEET>)ViewBag.Record)
                        {
                            <tr class="@((ti++) % 2 == 0 ? "odd" : "even")">
                                <td>
                                    @DocForShow.NUM
                                </td>
                                <td>
                                    @DocForShow.PHONE
                                </td>
                                <td style="text-align: center">
                                    @Split(DocForShow.CONTENT, 4)
                                </td>
                                <td style="text-align: center">
                                    @Split(DocForShow.CONTENT, 0)
                                </td>
                                <td style="text-align: center">
                                    @Split(DocForShow.CONTENT, 1)
                                </td>
                                <td style="text-align: center">
                                    @Split(DocForShow.CONTENT, 2)
                                </td>
                                <td style="text-align: center">
                                    @Split(DocForShow.CONTENT, 3)
                                </td>
                                <td style="text-align: center">
                                    @DocForShow.STARTTIME
                                </td>
                                <td style="text-align: center">
                                    @DocForShow.ENDTIME
                                </td>
                                <td style="text-align: center">
                                    @DocForShow.ANUM
                                </td>
                                <td>
                                    <a target="_blank" href="/doc/detail?id=@(DocForShow.NUM)">查看详情</a>
                                </td>
                            </tr>
                        }
                    </tbody>
                </table>
                }
                else
                {
                <div class="container1">
                    <div class="notification error">
                        <a class="close" href="#"></a><em>
                            <img alt="" src="/assets/img/icons/cross_circle.png">未搜索到数据,请尝试其他搜索条件</em></div>
                </div>
                }
            }
        </div>
    </div>
    <div class="clear">
    </div>
</body>
</html>
